from django.contrib.auth import get_user_model
from rest_framework import serializers
from utils.now import my_now
from .models import *
from apps.source.models import *

User = get_user_model()


class QuotationSerializer(serializers.ModelSerializer):
    queryset1 = Customer.objects.all()
    queryset2 = ProductSource.objects.all()
    queryset3 = User.objects.all()
    F001 = serializers.SlugRelatedField(slug_field='B001', queryset=queryset1, label='客户')
    F002 = serializers.SlugRelatedField(slug_field='D002', queryset=queryset2, label='产品')
    F003 = serializers.SlugRelatedField(slug_field='username', queryset=queryset3, label='报价人')

    class Meta:
        model = Quotation
        fields = '__all__'
